# encoding: utf-8
# @File  : 08CSS选择器定位-属性选择器.py
# @Author: Morpheus
# @Date  : 2025/10/31/10:43



# 导包
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
# 创建浏览器驱动
driver = webdriver.Chrome()
# 获取访问页面
driver.get("http://121.43.169.97:8848/pageA.html")
# 放大浏览器
driver.maximize_window()
time.sleep(1)
# 模拟用户操作
# 获取用户名：通过标签ID、标签属性、标签class、标签名
driver.find_element(By.CSS_SELECTOR, "#userA").send_keys("admin") # id属性值
driver.find_element(By.CSS_SELECTOR, "[name='passwordA']").send_keys("123456") # 标签属性
driver.find_element(By.CSS_SELECTOR, ".telA").send_keys("13800000001") # class属性值
# 输入邮箱信息：多个class值，通过点号连接
driver.find_element(by=By.CSS_SELECTOR,
                    value=".emailA.dzyxA").send_keys("123456@qq.com")
driver.find_element(By.CSS_SELECTOR, "button").click() # 标签名
# 等待3秒
time.sleep(3)
# 退出浏览器
driver.quit()
# 导包
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
# 创建浏览器驱动
driver = webdriver.Chrome()

